<?php
/**
 * Created by PhpStorm.
 * User: muyu666
 * Date: 2016/5/22
 * Time: 8:56
 */
namespace Admin\Model;
use Think\Model;
class SaveauthModel extends Model {
    public function saveauth($roleid,$authids)
    {
        //数组转字符串
        $authids = implode(',',$authids);

        //权限路径制作
        $authinfo = D('Auth')->select($authids);
        foreach ($authinfo as $k => $v){
            if(!empty($v['auth-c']) && !empty($v['auth-a'])){
           $s .= $v['auth-c']."-".$v['auth-a'].",";
        }
        }
        $data['role-ids'] = $authids;
        $data['role-auth-ca'] = $s;
        $where['id'] = $roleid;
        return $info = $this->where($where)->save($data);
    }
}